/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package twbb.adaptive;


import edu.cuny.cat.server.GameClock;
import edu.cuny.cat.server.GameController;
/**
 *
 * @author sun
 */
public class KnowledgeAdaptive {

    GameClock clock;

    protected int dayLen = clock.getDayLen();
	protected int roundLen = clock.getRoundLen();
    protected int gameLen = clock.getGameLen();

    protected int periodLen = 20; // each period length is 20 day
    protected int beginningLen = 20; // Number of beginning day
    protected int finalLen = 20; // Number of final day

    protected int expansionLen = 3; //Number of expansion round
    protected int sprint = 1; //Number of sprint round
    protected int convergenceLen = dayLen - expansionLen - sprint; //Number of convergence round

    protected int round;
    protected int day;

    protected String dayAtPeriod;
    protected String roundAtPeriod;

    public KnowledgeAdaptive() {        
    }

    public String nowRoundAtPeriod(){

        round = clock.getRound();

        if(round <= expansionLen){
            roundAtPeriod = "expansion";
        }else if(round <= (expansionLen + convergenceLen)){
            roundAtPeriod = "convergence";
        }else if(round <= dayLen){
            roundAtPeriod = "sprint";
        }else{
            roundAtPeriod = "default"; // restore default value when unknow or exception
        }

        return roundAtPeriod;

    }

    public String nowDayAtPeriod(){

        day = clock.getDay();

        if(day <= beginningLen){
            dayAtPeriod = "beginning"; // marketshare first
        }else if( day >= (gameLen - finalLen) ){
            dayAtPeriod = "final"; // profit first
        }else{
            dayAtPeriod = "general"; // equilibrium
        }
        return dayAtPeriod;
    }

    public String stateAlgorithms(){
        return "null";
    }

    public String strategiesAlgorithms(){
        return "null";
    }

    public String decisionAlgorithms(){
        return "null";
    }

}
